﻿#include "dataanatool.h"

dataanatool::dataanatool()
{

}
// 表格1
QVector<QVector<QString>> dataanatool::table1(QVector<QVector<QString>> inputdata){
    outtab1.clear();
    outtab1 = inputdata;
    double R1,R2,R3,X1;
    QSqlDatabase db = dbHelper::openConnection();
    QString sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("R1");
    QSqlQuery query(db);
    query.exec(sql);
    while (query.next()) {
        R1 = query.value("Num").toDouble();
    }
    sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("R2");
    query.exec(sql);
    while (query.next()) {
        R2 = query.value("Num").toDouble();
    }
    sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("R3");
    query.exec(sql);
    while (query.next()) {
        R3 = query.value("Num").toDouble();
    }
    sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("X1");
    query.exec(sql);
    while (query.next()) {
        X1 = query.value("Num").toDouble();
    }
    double ctall = 0;
    int bzsum = 0;
    for(int i=0;i<inputdata.length();i+=4){
        if(inputdata[i][3].contains("sta",Qt::CaseInsensitive)||inputdata[i][3].contains("std",Qt::CaseInsensitive)||inputdata[i][3].contains("标准品",Qt::CaseInsensitive)){
            ctall+=inputdata[i+3][4].toDouble();
            bzsum++;
        }
    }
    double ctavg = ctall/bzsum;
    for(int i=0;i<inputdata.length();i+=4){
        double cyct=inputdata[i+3][4].toDouble();
        double famn=inputdata[i][5].toDouble();
        double vicn=inputdata[i+1][5].toDouble();
        double roxn=inputdata[i+2][5].toDouble();
        // 总浓度
        if(true){
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(vicn));
            }
        }
        // 男性浓度-男女浓度比例
        if(famn==0){
            if(vicn<X1){
                for(int j=0;j<4;j++){
                    outtab1[i+j].append("un");
                    outtab1[i+j].append("un");
                    outtab1[i+j].append("浓度过低无法判断");
                    outtab1[i+j].append("-");
                }
            }else if(vicn>=X1){
                for(int j=0;j<4;j++){
                    outtab1[i+j].append("un");
                    outtab1[i+j].append(QString::number(vicn,'f',2));
                    outtab1[i+j].append("女");
                    outtab1[i+j].append("-");
                }
            }
        }else if(vicn/famn<R1){
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(famn,'f',2));
                outtab1[i+j].append("un");
                outtab1[i+j].append("男");
                outtab1[i+j].append("-");
            }
        }else if(vicn/famn>=R1&&vicn<=X1){
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(famn,'f',2));
                outtab1[i+j].append("un");
                outtab1[i+j].append("男");
                outtab1[i+j].append("-");
            }
        }else if(vicn/famn>=R1&&vicn/famn<R2&&vicn>X1){
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(famn,'f',2));
                outtab1[i+j].append(QString::number(vicn-famn,'f',2));
                outtab1[i+j].append(">70%可能混");
                outtab1[i+j].append("1:"+QString::number((vicn-famn)/famn,'f',2));
            }
        }else if(vicn/famn>=R2&&vicn/famn<R3&&vicn>X1){
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(famn,'f',2));
                outtab1[i+j].append(QString::number(vicn-famn,'f',2));
                outtab1[i+j].append(">85%可能混");
                outtab1[i+j].append("1:"+QString::number((vicn-famn)/famn,'f',2));
            }
        }else if(vicn/famn>=R3&&vicn>X1){
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(famn,'f',2));
                outtab1[i+j].append(QString::number(vicn-famn,'f',2));
                outtab1[i+j].append(">95%可能混");
                outtab1[i+j].append("1:"+QString::number((vicn-famn)/famn,'f',2));
            }
        }else{
            for(int j=0;j<4;j++){
                outtab1[i+j].append("");
                outtab1[i+j].append("");
                outtab1[i+j].append("");
                outtab1[i+j].append("");
            }
        }
        //降解指数
        if(roxn==0){
            for(int j=0;j<4;j++){
                outtab1[i+j].append("nan");
            }
        }else{
            for(int j=0;j<4;j++){
                outtab1[i+j].append(QString::number(vicn/roxn,'f',2));
            }
        }
        // 抑制指数
        for(int j=0;j<4;j++){
            outtab1[i+j].append(QString::number(cyct-ctavg,'f',2));
        }
    }
    return outtab1;
}
// 表格2
QVector<QVector<QString>> dataanatool::table2(QVector<QVector<QString>> inputdata){
    tsxx.clear();
    outtab2.clear();
    outtab2c.clear();
    STRtype.clear();
    map.clear();
    int sum=0;
    QSqlDatabase db = dbHelper::openConnection();
    QSqlQuery query(db);
    QString sql="SELECT Name FROM ItemCode WHERE DicCode=16 and IsDefault=1 ";
    query.exec(sql);
    while (query.next()) {
        STRtype.append(query.value("Name").toString());
    }
    sql="SELECT Name FROM ItemCode WHERE DicCode=17 and IsDefault=1 ";
    query.exec(sql);
    while (query.next()) {
        STRtype.append(query.value("Name").toString());
    }
    sql="SELECT Name FROM ItemCode WHERE DicCode=18 and IsDefault=1 ";
    query.exec(sql);
    while (query.next()) {
        STRtype.append(query.value("Name").toString());
    }
    sql="SELECT Name FROM ItemCode WHERE DicCode=19 and IsDefault=1 ";
    query.exec(sql);
    while (query.next()) {
        sysval=query.value("Name").toString();
    }
    sql=QString("SELECT m.SystemName,m.SystemNum from DataAnalyseConfig d,ModelConfigurationNormal m where m.ID=d.ModelGuid and d.ReagentKitType='%1' and d.ReagentKitName='%2' and d.System='%3' ;")
            .arg("常STR",STRtype[0],sysval);
    query.exec(sql);
    while (query.next()) {
        map.insert(query.value("SystemName").toString(),query.value("SystemNum").toString());
    }
    if(sum==map.count()){
        tsxx.append("常STR模型缺失 ");
    }
    sum = map.count();
    sql=QString("SELECT m.SystemName,m.SystemNum from DataAnalyseConfig d,ModelConfigurationY m where m.ID=d.ModelGuid and d.ReagentKitType='%1' and d.ReagentKitName='%2'  ;")
            .arg("Y-STR",STRtype[1]);
    query.exec(sql);
    while (query.next()) {
        map.insert(query.value("SystemName").toString(),query.value("SystemNum").toString());
    }
    if(sum==map.count()){
        tsxx.append("Y-STR模型缺失 ");
    }
    sum = map.count();
    sql=QString("SELECT m.SystemName,m.SystemNum from DataAnalyseConfig d,ModelConfigurationMini m where m.ID=d.ModelGuid and d.ReagentKitType='%1' and d.ReagentKitName='%2'  ;")
            .arg("mini-STR",STRtype[2]);
    query.exec(sql);
    qDebug()<<STRtype;
    while (query.next()) {
        map.insert(query.value("SystemName").toString(),query.value("SystemNum").toString());
    }
    if(sum==map.count()){
        tsxx.append("mini-STR模型缺失 ");
    }
    sum = map.count();
    if(map.count()==0){
        tsxx="模型缺失";
    }
    if(!tsxx.isEmpty()){
        QMessageBox* msgBox = new QMessageBox(QMessageBox::Warning,"警告",tsxx);//参数 Icon icon, const QString &title, const QString &text,
        msgBox->setModal(false);//设置为非模态
        msgBox->setWindowFlags(Qt::WindowStaysOnTopHint);
        msgBox->setAttribute(Qt::WA_DeleteOnClose); //关掉消息框后删除指针
        msgBox->show();
    }
    outtab2=inputdata;
    for(int i=0;i<outtab2.length();i++){
        for(int j=outtab2[i].length()-1;j>=2;j--){
            outtab2[i].remove(j);
        }
    }
    for(int i=0;i<outtab2.length();i++){
        for(int j=0;j<10;j++){
            outtab2[i].append("");
        }
    }
    for(int i=0;i<outtab2.length();i+=4){
        if(sysval=="10"){
            // 常10
            for(int j=0;j<4;j++){
                double DI = inputdata[i][11].toDouble();
                double AS = inputdata[i][6].toDouble();
                double d = inputdata[i+2][5].toDouble();
                if(sysval=="10"){
                    QScriptEngine engine;
                    QString gs = map.value("Da");
                    gs.replace("DI", "%1");
                    double Da = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("Db");
                    gs.replace("DI", "%1");
                    double Db = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("Dc");
                    gs.replace("DI", "%1");
                    double Dc = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("Dd");
                    gs.replace("DI", "%1");
                    double Dd = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("De");
                    gs.replace("DI", "%1");
                    double De = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("MXa");
                    gs.replace("DI", "%1");
                    double MXa = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("MXb");
                    gs.replace("DI", "%1");
                    double MXb = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("MXc");
                    gs.replace("DI", "%1");
                    double MXc = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("MXd");
                    gs.replace("DI", "%1");
                    double MXd = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                    gs = map.value("MXe");
                    gs.replace("DI", "%1");
                    double MXe = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();

                    double ASN2=map.value("Md").toDouble()/map.value("Mv").toDouble();
                    double ASN3=map.value("Md").toDouble()/4;
                    double ASN4=map.value("Md").toDouble()/3;
                    double ASN5=map.value("Md").toDouble()/2;
                    double ASN6=map.value("Mx").toDouble();
                    double Ls = map.value("Ls").toDouble();
                    double ALN1 = map.value("La").toDouble();
                    double ALN2 = Da/map.value("Mv").toDouble();
                    double ALN3 = Da/4;
                    double ALN4 = Da/3;
                    double ALN5 = Da/2;
                    double ALN6 = MXa;
                    double ALN7 = map.value("Lb").toDouble();
                    double ALN8 = Db/map.value("Mv").toDouble();
                    double ALN9 = Db/4;
                    double ALN10 = Db/3;
                    double ALN11 = Db/2;
                    double ALN12 = MXb;
                    double ALN13 = map.value("Lc").toDouble();
                    double ALN14 = Dc/map.value("Mv").toDouble();
                    double ALN15 = Dc/4;
                    double ALN16 = Dc/3;
                    double ALN17 = Dc/2;
                    double ALN18 = MXc;
                    double ALN19 = map.value("Ld").toDouble();
                    double ALN20 = Dd/map.value("Mv").toDouble();
                    double ALN21 = Dd/4;
                    double ALN22 = Dd/3;
                    double ALN23 = Dd/2;
                    double ALN24 = MXd;
                    double ALN25 = map.value("Le").toDouble();
                    double ALN26 = De/map.value("Mv").toDouble();
                    double ALN27 = De/4;
                    double ALN28 = De/3;
                    double ALN29 = De/2;
                    double ALN30 = MXe;
                    outtab2[i+j][2]="常STR";
                    if(DI<1.5){
                        if(AS==0){
                            outtab2[i+j][10]="-";
                            outtab2[i+j][11]="未检测到DNA";
                            outtab2[i+j][2]="-";
                            outtab2[i+j][3]="-";
                        }else if(AS<=Ls){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][11]="浓度过低可根据情况决定是否做STR";
                            outtab2[i+j][3]="无";
                        }else if(AS>Ls&&AS<ASN2){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }else if(AS>=ASN2&&AS<=ASN3){
                            outtab2[i+j][10]="4ul";
                            outtab2[i+j][3]="无";
                        }else if(AS>ASN3&&AS<=ASN4){
                            outtab2[i+j][10]="3ul";
                            outtab2[i+j][3]="无";
                        }else if(AS>ASN4&&AS<=ASN5){
                            outtab2[i+j][10]="2ul";
                            outtab2[i+j][3]="无";
                        }else if(AS>ASN5&&AS<=ASN6){
                            outtab2[i+j][10]="1ul";
                            outtab2[i+j][3]="无";
                        }else if(AS>ASN6){
                            outtab2[i+j][10]="稀释至AS"+QString::number(map.value("Md").toDouble()/2)+"ng/ul上样2ul";
                            outtab2[i+j][3]=QString::number(AS/(map.value("Md").toDouble()/2));
                        }
                    }else if(DI>=1.5&&DI<=4){
                        outtab2[i+j][11]="轻度降解";
                        if(d<ALN1&&AS>0&&AS<=Ls){
                            outtab2[i+j][10]=map.value("Iv")+"ul";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d<ALN1&&AS>Ls){
                            outtab2[i+j][10]="mini";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d>=ALN1&&d<=ALN2){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN2&&d<=ALN3){
                            outtab2[i+j][10]="4ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN3&&d<=ALN4){
                            outtab2[i+j][10]="3ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN4&&d<=ALN5){
                            outtab2[i+j][10]="2ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN5&&d<=ALN6){
                            outtab2[i+j][10]="1ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN6){
                            outtab2[i+j][10]="稀释至AL"+QString::number(map.value("Da").toDouble()/2)+"ng/ul上样2ul";
                            outtab2[i+j][3]=QString::number(d/(map.value("Da").toDouble()/2));
                        }
                    }else if(DI>4&&DI<=12){
                        outtab2[i+j][11]="较严重降解";
                        if(d<ALN7&&AS>0&&AS<=Ls){
                            outtab2[i+j][10]=map.value("Iv")+"ul";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d<ALN7&&AS>Ls){
                            outtab2[i+j][10]="mini";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d>=ALN7&&d<=ALN8){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN8&&d<=ALN9){
                            outtab2[i+j][10]="4ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN9&&d<=ALN10){
                            outtab2[i+j][10]="3ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN10&&d<=ALN11){
                            outtab2[i+j][10]="2ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN11&&d<=ALN12){
                            outtab2[i+j][10]="1ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN12){
                            outtab2[i+j][10]="稀释至AL"+QString::number(map.value("Db").toDouble()/2)+"ng/ul上样2ul";
                            outtab2[i+j][3]=QString::number(d/(map.value("Db").toDouble()/2));
                        }
                    }else if(DI>12&&DI<=20){
                        outtab2[i+j][11]="严重降解";
                        if(d<ALN13&&AS>0&&AS<=Ls){
                            outtab2[i+j][10]=map.value("Iv")+"ul";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d<ALN13&&AS>Ls){
                            outtab2[i+j][10]="mini";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d>=ALN13&&d<=ALN14){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN14&&d<=ALN15){
                            outtab2[i+j][10]="4ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN15&&d<=ALN16){
                            outtab2[i+j][10]="3ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN16&&d<=ALN17){
                            outtab2[i+j][10]="2ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN17&&d<=ALN18){
                            outtab2[i+j][10]="1ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN18){
                            outtab2[i+j][10]="稀释至AL"+QString::number(map.value("Dc").toDouble()/2)+"ng/ul上样2ul";
                            outtab2[i+j][3]=QString::number(d/(map.value("Dc").toDouble()/2));
                        }
                    }else if(DI>20&&DI<=35){
                        outtab2[i+j][11]="严重降解";
                        if(d<ALN19&&AS>0&&AS<=Ls){
                            outtab2[i+j][10]=map.value("Iv")+"ul";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d<ALN19&&AS>Ls){
                            outtab2[i+j][10]="mini";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d>=ALN19&&d<=ALN20){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN20&&d<=ALN21){
                            outtab2[i+j][10]="4ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN21&&d<=ALN22){
                            outtab2[i+j][10]="3ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN22&&d<=ALN23){
                            outtab2[i+j][10]="2ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN23&&d<=ALN24){
                            outtab2[i+j][10]="1ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN24){
                            outtab2[i+j][10]="稀释至AL"+QString::number(map.value("Dd").toDouble()/2)+"ng/ul上样2ul";
                            outtab2[i+j][3]=QString::number(d/(map.value("Dd").toDouble()/2));
                        }
                    }else if(DI>35&&DI<=80){
                        outtab2[i+j][11]="严重降解";
                        if(d<ALN25&&AS>0&&AS<=Ls){
                            outtab2[i+j][10]=map.value("Iv")+"ul";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d<ALN25&&AS>Ls){
                            outtab2[i+j][10]="mini";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }else if(d>=ALN25&&d<=ALN26){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN26&&d<=ALN27){
                            outtab2[i+j][10]="4ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN27&&d<=ALN28){
                            outtab2[i+j][10]="3ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN28&&d<=ALN29){
                            outtab2[i+j][10]="2ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN29&&d<=ALN30){
                            outtab2[i+j][10]="1ul";
                            outtab2[i+j][3]="无";
                        }else if(d>ALN30){
                            outtab2[i+j][10]="稀释至AL"+QString::number(map.value("De").toDouble()/2)+"ng/ul上样2ul";
                            outtab2[i+j][3]=QString::number(d/(map.value("De").toDouble()/2));
                        }
                    }else if(DI>80||DI==0){
                        outtab2[i+j][11]="严重降解";
                        if(map.value("Ni").toInt()==0){
                            outtab2[i+j][10]=map.value("Mv")+"ul";
                            outtab2[i+j][3]="无";
                        }if(map.value("Ni").toInt()==1){
                            outtab2[i+j][10]="mini";
                            outtab2[i+j][3]="无";
                            outtab2[i+j][2]="mini-STR";
                        }
                    }else{
                        outtab2[i+j][10]=map.value("Mv")+"ul";
                        outtab2[i+j][3]="无";
                    }
                }
            }
        }else if(sysval=="15"){
            double DI = inputdata[i][11].toDouble();
            double AS = inputdata[i][6].toDouble();
            double d = inputdata[i+2][5].toDouble();
            for(int j=0;j<4;j++){
                QScriptEngine engine;
                QString gs = map.value("Da*");
                gs.replace("DI", "%1");
                double Da_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Db*");
                gs.replace("DI", "%1");
                double Db_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Dc*");
                gs.replace("DI", "%1");
                double Dc_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Dd*");
                gs.replace("DI", "%1");
                double Dd_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("De*");
                gs.replace("DI", "%1");
                double De_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("MXa*");
                gs.replace("DI", "%1");
                double MXa_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("MXb*");
                gs.replace("DI", "%1");
                double MXb_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("MXc*");
                gs.replace("DI", "%1");
                double MXc_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("MXd*");
                gs.replace("DI", "%1");
                double MXd_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("MXe*");
                gs.replace("DI", "%1");
                double MXe_ = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                double ASN2=map.value("Md*").toDouble()/map.value("Mv*").toDouble();
                double ASN3=map.value("Md*").toDouble()/15;
                double ASN4=map.value("Md*").toDouble()/12;
                double ASN5=map.value("Md*").toDouble()/10;
                double ASN6=map.value("Md*").toDouble()/8;
                double ASN7=map.value("Md*").toDouble()/6;
                double ASN8=map.value("Md*").toDouble()/4;
                double ASN9=map.value("Md*").toDouble()/2;
                double ASN10=map.value("Mx*").toDouble();
                double Ls_ = map.value("Ls*").toDouble();
                double ALN1 = map.value("La*").toDouble();
                double ALN2 = Da_/map.value("Mv*").toDouble();
                double ALN3 = Da_/15;
                double ALN4 = Da_/12;
                double ALN5 = Da_/10;
                double ALN6 = Da_/8;
                double ALN7 = Da_/6;
                double ALN8 = Da_/4;
                double ALN9 = Da_/2;
                double ALN10 = MXa_;
                double ALN11 = map.value("Lb*").toDouble();
                double ALN12 = Db_/map.value("Mv*").toDouble();
                double ALN13 = Db_/15;
                double ALN14 = Db_/12;
                double ALN15 = Db_/10;
                double ALN16 = Db_/8;
                double ALN17 = Db_/6;
                double ALN18 = Db_/4;
                double ALN19 = Db_/2;
                double ALN20 = MXb_;
                double ALN21 = map.value("Lc*").toDouble();
                double ALN22 = Dc_/map.value("Mv*").toDouble();
                double ALN23 = Dc_/15;
                double ALN24 = Dc_/12;
                double ALN25 = Dc_/10;
                double ALN26 = Dc_/8;
                double ALN27 = Dc_/6;
                double ALN28 = Dc_/4;
                double ALN29 = Dc_/2;
                double ALN30 = MXc_;
                double ALN31 = map.value("Ld*").toDouble();
                double ALN32 = Dd_/map.value("Mv*").toDouble();
                double ALN33 = Dd_/15;
                double ALN34 = Dd_/12;
                double ALN35 = Dd_/10;
                double ALN36 = Dd_/8;
                double ALN37 = Dd_/6;
                double ALN38 = Dd_/4;
                double ALN39 = Dd_/2;
                double ALN40 = MXd_;
                double ALN41 = map.value("Le*").toDouble();
                double ALN42 = De_/map.value("Mv*").toDouble();
                double ALN43 = De_/15;
                double ALN44 = De_/12;
                double ALN45 = De_/10;
                double ALN46 = De_/8;
                double ALN47 = De_/6;
                double ALN48 = De_/4;
                double ALN49 = De_/2;
                double ALN50 = MXe_;
                outtab2[i+j][3]="常STR";
                if(DI<1.5){
                    if(AS==0){
                        outtab2[i+j][10]="-";
                        outtab2[i+j][11]="未检测到DNA";
                        outtab2[i+j][2]="-";
                        outtab2[i+j][3]="-";
                    }else if(AS<=Ls_){
                        outtab2[i+j][10]=map.value("Mv*")+"ul";
                        outtab2[i+j][11]="浓度过低可根据情况决定是否做STR";
                        outtab2[i+j][3]="无";
                    }else if(AS>Ls_&&AS<ASN2){
                        outtab2[i+j][10]=map.value("Mv*")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>=ASN2&&AS<=ASN3){
                        outtab2[i+j][10]="15ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN3&&AS<=ASN4){
                        outtab2[i+j][10]="12ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN4&&AS<=ASN5){
                        outtab2[i+j][10]="10ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN5&&AS<=ASN6){
                        outtab2[i+j][10]="8ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN6&&AS<=ASN7){
                        outtab2[i+j][10]="6ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN7&&AS<=ASN8){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN8&&AS<=ASN9){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN9&&AS<=ASN10){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>ASN10){
                        outtab2[i+j][10]="稀释至AS"+QString::number(map.value("Md*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(AS/(map.value("Md*").toDouble()/2));
                    }

                }else if(DI>=1.5&&DI<=4){
                    outtab2[i+j][11]="轻度降解";
                    if(d<ALN1&&AS>0&&AS<=Ls_){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d<ALN1&&AS>Ls_){
                        outtab2[i+j][10]="mini";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d>=ALN1&&d<=ALN2){
                        outtab2[i+j][10]=map.value("Mv*");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN2&&d<=ALN3){
                        outtab2[i+j][10]=map.value("15ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN3&&d<=ALN4){
                        outtab2[i+j][10]=map.value("12ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN4&&d<=ALN5){
                        outtab2[i+j][10]=map.value("10ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN5&&d<=ALN6){
                        outtab2[i+j][10]=map.value("8ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN6&&d<=ALN7){
                        outtab2[i+j][10]=map.value("6ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN7&&d<=ALN8){
                        outtab2[i+j][10]=map.value("4ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN8&&d<=ALN9){
                        outtab2[i+j][10]=map.value("2ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN9&&d<=ALN10){
                        outtab2[i+j][10]=map.value("1ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN10){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Da_/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Da_/2));
                    }
                }else if(DI>4&&DI<=12){
                    outtab2[i+j][11]="较严重降解";
                    if(d<ALN11&&AS>0&&AS<=Ls_){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d<ALN11&&AS>Ls_){
                        outtab2[i+j][10]="mini";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d>=ALN11&&d<=ALN12){
                        outtab2[i+j][10]=map.value("Mv*");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN12&&d<=ALN13){
                        outtab2[i+j][10]=map.value("15ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN13&&d<=ALN14){
                        outtab2[i+j][10]=map.value("12ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN14&&d<=ALN15){
                        outtab2[i+j][10]=map.value("10ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN15&&d<=ALN16){
                        outtab2[i+j][10]=map.value("8ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN16&&d<=ALN17){
                        outtab2[i+j][10]=map.value("6ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN17&&d<=ALN18){
                        outtab2[i+j][10]=map.value("4ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN18&&d<=ALN19){
                        outtab2[i+j][10]=map.value("2ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN19&&d<=ALN20){
                        outtab2[i+j][10]=map.value("1ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN20){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Db_/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Db_/2));
                    }
                }else if(DI>12&&DI<=20){
                    outtab2[i+j][11]="严重降解";
                    if(d<ALN1&&AS>0&&AS<=Ls_){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d<ALN1&&AS>Ls_){
                        outtab2[i+j][10]="mini";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d>=ALN21&&d<=ALN22){
                        outtab2[i+j][10]=map.value("Mv*");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN22&&d<=ALN23){
                        outtab2[i+j][10]=map.value("15ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN23&&d<=ALN24){
                        outtab2[i+j][10]=map.value("12ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN24&&d<=ALN25){
                        outtab2[i+j][10]=map.value("10ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN25&&d<=ALN26){
                        outtab2[i+j][10]=map.value("8ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN26&&d<=ALN27){
                        outtab2[i+j][10]=map.value("6ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN27&&d<=ALN28){
                        outtab2[i+j][10]=map.value("4ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN28&&d<=ALN29){
                        outtab2[i+j][10]=map.value("2ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN29&&d<=ALN30){
                        outtab2[i+j][10]=map.value("1ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN30){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Dc_/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Dc_/2));
                    }
                }else if(DI>20&&DI<=35){
                    outtab2[i+j][11]="严重降解";
                    if(d<ALN31&&AS>0&&AS<=Ls_){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d<ALN31&&AS>Ls_){
                        outtab2[i+j][10]="mini";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d>=ALN31&&d<=ALN32){
                        outtab2[i+j][10]=map.value("Mv*");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN32&&d<=ALN33){
                        outtab2[i+j][10]=map.value("15ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN33&&d<=ALN34){
                        outtab2[i+j][10]=map.value("12ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN34&&d<=ALN35){
                        outtab2[i+j][10]=map.value("10ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN35&&d<=ALN36){
                        outtab2[i+j][10]=map.value("8ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN36&&d<=ALN37){
                        outtab2[i+j][10]=map.value("6ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN37&&d<=ALN38){
                        outtab2[i+j][10]=map.value("4ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN38&&d<=ALN39){
                        outtab2[i+j][10]=map.value("2ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN39&&d<=ALN40){
                        outtab2[i+j][10]=map.value("1ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN40){
                        outtab2[i+j][10]=map.value("稀释至AL"+QString::number(Dd_/2)+"ng/ul上样2ul");
                        outtab2[i+j][3]=QString::number(d/(Dd_/2));
                    }
                }else if(DI>35&&DI<=80){
                    outtab2[i+j][11]="严重降解";
                    if(d<ALN41&&AS>0&&AS<=Ls_){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d<ALN41&&AS>Ls_){
                        outtab2[i+j][10]="mini";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }else if(d>=ALN41&&d<=ALN42){
                        outtab2[i+j][10]=map.value("Mv*");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN42&&d<=ALN43){
                        outtab2[i+j][10]=map.value("15ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN43&&d<=ALN44){
                        outtab2[i+j][10]=map.value("12ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN44&&d<=ALN45){
                        outtab2[i+j][10]=map.value("10ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN45&&d<=ALN46){
                        outtab2[i+j][10]=map.value("8ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN46&&d<=ALN47){
                        outtab2[i+j][10]=map.value("6ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN47&&d<=ALN48){
                        outtab2[i+j][10]=map.value("4ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN48&&d<=ALN49){
                        outtab2[i+j][10]=map.value("2ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN49&&d<=ALN50){
                        outtab2[i+j][10]=map.value("1ul");
                        outtab2[i+j][3]="无";
                    }else if(d>ALN50){
                        outtab2[i+j][10]=map.value("稀释至AL"+QString::number(De_/2)+"ng/ul上样2ul");
                        outtab2[i+j][3]=QString::number(d/(De_/2));
                    }
                }else if(DI>80||DI==0){
                    outtab2[i+j][11]="严重降解";
                    if(map.value("Ni").toInt()==0){
                        outtab2[i+j][10]=map.value("Mv*");
                        outtab2[i+j][3]="无";
                    }if(map.value("Ni").toInt()==0){
                        outtab2[i+j][10]="mini";
                        outtab2[i+j][3]="无";
                        outtab2[i+j][2]="mini-STR";
                    }
                }else{
                    outtab2[i+j][10]=map.value("Mv*");
                    outtab2[i+j][3]="无";
                }
            }
        }
        if(outtab2[i][10]=="mini"){
            double DI = inputdata[i][11].toDouble();
            double AS = inputdata[i][6].toDouble();
            double d = inputdata[i+2][5].toDouble();
            for(int j=0;j<4;j++){
                QScriptEngine engine;
                QString gs = map.value("Ia");
                gs.replace("DI", "%1");
                double Ia = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Ib");
                gs.replace("DI", "%1");
                double Ib = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Ic");
                gs.replace("DI", "%1");
                double Ic = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Id");
                gs.replace("DI", "%1");
                double Id = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("Ie");
                gs.replace("DI", "%1");
                double Ie = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("IXa");
                gs.replace("DI", "%1");
                double IXa = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("IXb");
                gs.replace("DI", "%1");
                double IXb = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("IXc");
                gs.replace("DI", "%1");
                double IXc = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("IXd");
                gs.replace("DI", "%1");
                double IXd = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("IXe");
                gs.replace("DI", "%1");
                double IXe = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                double M1 = map.value("Is").toDouble()/map.value("Iv").toDouble();
                double M2 = map.value("Is").toDouble()/4;
                double M3 = map.value("Is").toDouble()/3;
                double M4 = map.value("Is").toDouble()/2;
                double M5 = map.value("Ix").toDouble();
                double M6 = Ia/map.value("Iv").toDouble();
                double M7 = Ia/4;
                double M8 = Ia/3;
                double M9 = Ia/2;
                double M10 = IXa;
                double M11 = Ib/map.value("Iv").toDouble();
                double M12 = Ib/4;
                double M13 = Ib/3;
                double M14 = Ib/2;
                double M15 = IXb;
                double M16 = Ic/map.value("Iv").toDouble();
                double M17 = Ic/4;
                double M18 = Ic/3;
                double M19 = Ic/2;
                double M20 = IXc;
                double M21 = Id/map.value("Iv").toDouble();
                double M22 = Id/4;
                double M23 = Id/3;
                double M24 = Id/2;
                double M25 = IXd;
                double M26 = Ie/map.value("Iv").toDouble();
                double M27 = Ie/4;
                double M28 = Ie/3;
                double M29 = Ie/2;
                double M30 = IXe;
                if(DI<1.5){
                    if(AS<M1){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>=M1&&AS<=M2){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>M2&&AS<=M3){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>M3&&AS<=M4){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>M4&&AS<=M5){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(AS>M5){
                        outtab2[i+j][10]="稀释至AS"+QString::number(map.value("Is*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(AS/(map.value("Is*").toDouble()/2));
                    }
                }else if(DI>=1.5&&DI<=4){
                    if(d<M6){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=M6&&d<=M7){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M7&&d<=M8){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M8&&d<=M9){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M9&&d<=M10){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M10){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Ia/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Ia/2));
                    }
                }else if(DI>4&&DI<=12){
                    if(d<M11){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=M11&&d<=M12){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M12&&d<=M13){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M13&&d<=M14){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M14&&d<=M15){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M15){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Ib/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Ib/2));
                    }
                }else if(DI>12&&DI<=20){
                    if(d<M16){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=M16&&d<=M17){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M17&&d<=M18){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M18&&d<=M19){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M19&&d<=M20){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M20){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Ic/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Ic/2));
                    }
                }else if(DI>20&&DI<=35){
                    if(d<M21){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=M21&&d<=M22){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M22&&d<=M23){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M23&&d<=M24){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M24&&d<=M25){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M25){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Id/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Id/2));
                    }
                }else if(DI>35&&DI<=80){
                    if(d<M26){
                        outtab2[i+j][10]=map.value("Iv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=M26&&d<=M27){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M27&&d<=M28){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M28&&d<=M29){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M29&&d<=M30){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>M30){
                        outtab2[i+j][10]="稀释至AL"+QString::number(Ie/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(d/(Ie/2));
                    }
                }else if(DI>80||DI==0){
                    outtab2[i+j][10]=map.value("Iv")+"ul";
                    outtab2[i+j][3]="无";
                }else{
                    outtab2[i+j][10]=map.value("Iv")+"ul";
                    outtab2[i+j][3]="无";
                }
            }
        }
        xs(i);
        outtab2c = outtab2;
    }
    for(int i=0;i<outtab2.length();i+=4){
        double Ym = map.value("Ym").toDouble();
        if(inputdata[i+2][6].toDouble()>=Ym){
            double DI = inputdata[i][11].toDouble();
            double AS = inputdata[i][6].toDouble();
            double d = inputdata[i+2][5].toDouble();
            double Y = inputdata[i][5].toDouble();
            for(int j=0;j<4;j++){
                QScriptEngine engine;
                QString gs = map.value("YDa");
                gs.replace("DI", "%1");
                double YDa = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YDb");
                gs.replace("DI", "%1");
                double YDb = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YDc");
                gs.replace("DI", "%1");
                double YDc = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YDd");
                gs.replace("DI", "%1");
                double YDd = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YDe");
                gs.replace("DI", "%1");
                double YDe = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YXa");
                gs.replace("DI", "%1");
                double YXa = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YXb");
                gs.replace("DI", "%1");
                double YXb = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YXc");
                gs.replace("DI", "%1");
                double YXc = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YXd");
                gs.replace("DI", "%1");
                double YXd = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                gs = map.value("YXe");
                gs.replace("DI", "%1");
                double YXe = engine.evaluate(gs.arg(inputdata[i][11])).toString().toDouble();
                double Y1 = map.value("Yd").toDouble()/map.value("Yv").toDouble();
                double Y2 = map.value("Yd").toDouble()/4;
                double Y3 = map.value("Yd").toDouble()/3;
                double Y4 = map.value("Yd").toDouble()/2;
                double Y5 = map.value("Yx").toDouble();
                double Y6 = YDa/map.value("Yv").toDouble();
                double Y7 = YDa/4;
                double Y8 = YDa/3;
                double Y9 = YDa/2;
                double Y10 = YDa/1.5;
                double Y11 = YXa;
                double Y12 = YDb/map.value("Yv").toDouble();
                double Y13 = YDb/4;
                double Y14 = YDb/3;
                double Y15 = YDb/2;
                double Y16 = YDb/1.5;
                double Y17 = YXb;
                double Y18 = YDc/map.value("Yv").toDouble();
                double Y19 = YDc/4;
                double Y20 = YDc/3;
                double Y21 = YDc/2;
                double Y22 = YDc/1.5;
                double Y23 = YXc;
                double Y24 = YDd/map.value("Yv").toDouble();
                double Y25 = YDd/4;
                double Y26 = YDd/3;
                double Y27 = YDd/2;
                double Y28 = YDd/1.5;
                double Y29 = YXd;
                double Y30 = YDe/map.value("Yv").toDouble();
                double Y31 = YDe/4;
                double Y32 = YDe/3;
                double Y33 = YDe/2;
                double Y34 = YDe/1.5;
                double Y35 = YXe;
                outtab2[i+j][2]="Y-STR";
                if(DI<=2){
                    if(d<Y1){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=Y1&&d<=Y2){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y2&&d<=Y3){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y3&&d<=Y4){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y4&&d<=Y5){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y5){
                        outtab2[i+j][10]="稀释至Y"+QString::number(map.value("Yd*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(Y/(map.value("Yd*").toDouble()/2));
                    }
                }else if(DI>2&&DI<=4){
                    if(d<Y6){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=Y6&&d<=Y7){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y7&&d<=Y8){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y8&&d<=Y9){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y9&&d<=Y10){
                        outtab2[i+j][10]="1.5ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y10&&d<=Y11){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y11){
                        outtab2[i+j][10]="稀释至Y"+QString::number(map.value("YDa*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=Y/(map.value("YDa*").toDouble()/2);
                    }
                }else if(DI>4&&DI<=12){
                    if(d<Y12){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=Y12&&d<=Y13){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y13&&d<=Y14){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y14&&d<=Y15){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y15&&d<=Y16){
                        outtab2[i+j][10]="1.5ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y16&&d<=Y17){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y17){
                        outtab2[i+j][10]="稀释至Y"+QString::number(map.value("YDb*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(Y/(map.value("YDb*").toDouble()/2));
                    }
                }else if(DI>12&&DI<=20){
                    if(d<Y18){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=Y18&&d<=Y19){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y19&&d<=Y20){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y20&&d<=Y21){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y21&&d<=Y22){
                        outtab2[i+j][10]="1.5ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y22&&d<=Y23){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y23){
                        outtab2[i+j][10]="稀释至Y"+QString::number(map.value("YDc*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(Y/(map.value("YDc*").toDouble()/2));
                    }
                }else if(DI>20&&DI<=35){
                    if(d<Y24){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=Y24&&d<=Y25){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y25&&d<=Y26){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y26&&d<=Y27){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y27&&d<=Y28){
                        outtab2[i+j][10]="1.5ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y28&&d<=Y29){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y29){
                        outtab2[i+j][10]="稀释至Y"+QString::number(map.value("YDd*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(Y/(map.value("YDd*").toDouble()/2));
                    }
                }else if(DI>35&&DI<=80){
                    if(d<Y30){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(d>=Y30&&d<=Y31){
                        outtab2[i+j][10]="4ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y31&&d<=Y32){
                        outtab2[i+j][10]="3ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y32&&d<=Y33){
                        outtab2[i+j][10]="2ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y33&&d<=Y34){
                        outtab2[i+j][10]="1.5ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y34&&d<=Y35){
                        outtab2[i+j][10]="1ul";
                        outtab2[i+j][3]="无";
                    }else if(d>Y35){
                        outtab2[i+j][10]="稀释至Y"+QString::number(map.value("YDe*").toDouble()/2)+"ng/ul上样2ul";
                        outtab2[i+j][3]=QString::number(Y/(map.value("YDe*").toDouble()/2));
                    }
                }else if(DI>80||DI==0){
                    if(map.value("Ni").toInt()==1){
                        outtab2[i+j][10]=map.value("Yv")+"ul";
                        outtab2[i+j][3]="无";
                    }else if(map.value("Ni").toInt()==0){
                        outtab2[i+j][10]="";
                        outtab2[i+j][3]="无";
                    }
                }else{
                    outtab2[i+j][10]="";
                    outtab2[i+j][3]="无";
                }
            }
        }
        xs(i);
    }
    return outtab2;
}
// 稀释方案
void dataanatool::xs(int row){
    if(outtab2[row][2]=="常STR"){
        if(outtab2[row][3]=="无"){
        }else if(outtab2[row][4].toInt()<=100){
            outtab2[row][4]=outtab2[row][3];
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
        }else if(outtab2[row][4].toInt()<=1000&&outtab2[row][4].toInt()>100){
            outtab2[row][4]="20";
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
            outtab2[row][7]=QString::number(outtab2[row][4].toInt()/20);
            outtab2[row][8]="2";
            outtab2[row][9]=QString::number(2*outtab2[row][7].toInt()-2);
        }else if(outtab2[row][4].toInt()>1000){
            outtab2[row][4]="50";
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
            outtab2[row][7]=QString::number(outtab2[row][4].toInt()/50);
            outtab2[row][8]="2";
            outtab2[row][9]=QString::number(2*outtab2[row][7].toInt()-2);
        }
    }else if(outtab2[row][2]=="Y-STR"){
        if(outtab2[row][3]=="无"){
        }else if(outtab2[row][4].toInt()<=100){
            outtab2[row][4]=outtab2[row][3];
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
        }else if(outtab2[row][4].toInt()<=1000&&outtab2[row][4].toInt()>100){
            outtab2[row][4]="20";
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
            outtab2[row][7]=QString::number(outtab2[row][4].toInt()/20);
            outtab2[row][8]="2";
            outtab2[row][9]=QString::number(2*outtab2[row][7].toInt()-2);
        }else if(outtab2[row][4].toInt()>1000){
            outtab2[row][4]="50";
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
            outtab2[row][7]=QString::number(outtab2[row][4].toInt()/50);
            outtab2[row][8]="2";
            outtab2[row][9]=QString::number(2*outtab2[row][7].toInt()-2);
        }
        if(outtab2[row][3].toInt()!=0&&outtab2c[row][3].toInt()!=0){
            if(outtab2[row][3].toInt()/outtab2c[row][3].toInt()>=0.75&&outtab2[row][3].toInt()/outtab2c[row][3].toInt()<=1){
                outtab2c[row][3]=outtab2[row][3];
                outtab2c[row][4]=outtab2[row][4];
                outtab2c[row][5]=outtab2[row][5];
                outtab2c[row][6]=outtab2[row][6];
                outtab2c[row][7]=outtab2[row][7];
                outtab2c[row][8]=outtab2[row][8];
                outtab2c[row][9]=outtab2[row][9];
                outtab2[row][11].append("可使用常-STR稀释产物做Y-STR。");
            }else if(outtab2[row][3].toInt()/outtab2c[row][3].toInt()>=1&&outtab2[row][3].toInt()/outtab2c[row][3].toInt()<=1.25){
                outtab2[row][3]=outtab2c[row][3];
                outtab2[row][4]=outtab2c[row][4];
                outtab2[row][5]=outtab2c[row][5];
                outtab2[row][6]=outtab2c[row][6];
                outtab2[row][7]=outtab2c[row][7];
                outtab2[row][8]=outtab2c[row][8];
                outtab2[row][9]=outtab2c[row][9];
                outtab2[row][11].append("可使用常-STR稀释产物做Y-STR。");
            }
            if(outtab2c[row][2]=="常STR"&&outtab2c[row][3].toInt()>1000){
                if(outtab2c[row][3].toInt()/100<=outtab2[row][3].toInt()&&outtab2[row][3].toInt()<=100){
                    outtab2c[row][4]=outtab2[row][3];
                }
            }else if(outtab2c[row][2]=="常STR"&&outtab2[row][4]==outtab2c[row][4]&&outtab2[row][7]==""){
                outtab2[row][11].append("可使用常-STR第一步稀释产物做Y-STR。");
            }else if(outtab2c[row][2]=="mini-STR"&&outtab2[row][4]==outtab2c[row][4]&&outtab2[row][7]==""){
                outtab2[row][11].append("可使用mini-STR第一步稀释产物做Y-STR。");
            }else if(outtab2c[row][2]=="常STR"&&outtab2[row][7]!=outtab2c[row][7]){
                outtab2[row][11].append("可使用常-STR第一步稀释产物进行第二步稀释。");
            }else if(outtab2c[row][2]=="mini-STR"&&outtab2[row][7]!=outtab2c[row][7]){
                outtab2[row][11].append("可使用mini-STR第一步稀释产物进行第二步稀释。");
            }else if(outtab2c[row][2]=="mini-STR"&&outtab2[row][3]==outtab2c[row][3]){
                outtab2[row][11].append("可使用mini-STR稀释产物做Y-STR。");
            }
        }


    }else if(outtab2[row][2]=="mini-STR"){
        if(outtab2[row][3]=="无"){
        }else if(outtab2[row][4].toInt()<=100){
            outtab2[row][4]=outtab2[row][3];
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
        }else if(outtab2[row][4].toInt()<=1000&&outtab2[row][4].toInt()>100){
            outtab2[row][4]="20";
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
            outtab2[row][7]=QString::number(outtab2[row][4].toInt()/20);
            outtab2[row][8]="2";
            outtab2[row][9]=QString::number(2*outtab2[row][7].toInt()-2);
        }else if(outtab2[row][4].toInt()>1000){
            outtab2[row][4]="50";
            outtab2[row][5]="2";
            outtab2[row][6]=QString::number(2*outtab2[row][4].toInt()-2);
            outtab2[row][7]=QString::number(outtab2[row][4].toInt()/50);
            outtab2[row][8]="2";
            outtab2[row][9]=QString::number(2*outtab2[row][7].toInt()-2);
        }
    }
}
// 导出后两页
void dataanatool::xyczjy(QXlsx::Document& xlsx,QVector<QString> sx){
    xlsx.addSheet("下游操作建议");


    if(sx.size() == 1 && sx[0] == "quanbu"){            // 传入内容为空时，选择全部孔位
        sx.clear();
        foreach(QVector<QString> line, outtab1){
            if(line.size()>0 && (!sx.contains(line[0]))){
                sx.push_back(line[0]);
            }
        }
    }


    xlsx.write("A1","总数:"+QString::number(outtab2.length()/4));
    xlsx.write("B1","筛选数量:");
    int cnum=0,ynum=0,mnum=0,xxnum=0;



    for(int i=0;i<outtab2c.length();i+=4){
        if(false){                  // 这里false是原来的sx[1]=="quanbu"
            if(outtab2c[i][2]=="常STR"){
                cnum++;
            }else if(outtab2c[i][2]=="mini-STR"){
                mnum++;
            }
        }else{
            for(int j=0;j<sx.length();j++){
                if(outtab2c[i][2]=="常STR"&&outtab2c[i][0]==sx[j]){
                    cnum++;
                }else if(outtab2c[i][2]=="mini-STR"&&outtab2c[i][0]==sx[j]){
                    mnum++;
                }
            }
        }

    }
    for(int i=0;i<outtab2.length();i+=4){
        if(false){
            if(outtab2[i][2]=="Y-STR"){
                ynum++;
            }
        }else{
            for(int j=0;j<sx.length();j++){
                if(outtab2[i][2]=="Y-STR"&&outtab2c[i][0]==sx[j]){
                    ynum++;
                }
            }
        }
    }
    for(int i=0;i<outtab2.length();i+=4){
        if(false){
            if(outtab2[i][3]!="无"){
                xxnum++;
            }
        }else{
            for(int j=0;j<sx.length();j++){
                if(outtab2[i][3]!="无"&&outtab2c[i][0]==sx[j]){
                    xxnum++;
                }
            }
        }
        //        if(outtab2c[i][3]!="无"){
        //            xxnum++;
        //        }
    }
    xlsx.write("C1","常STR数量:"+QString::number(cnum));
    xlsx.write("D1","需稀释数量:"+QString::number(xxnum));
    xlsx.write("E1","Y-STR数量:"+QString::number(ynum));
    xlsx.write("F1","mini-STR数量:"+QString::number(mnum));
    QXlsx::Format format;
    format.setFontColor(Qt::red);
    format.setFontSize(12);
    xlsx.write("H1",tsxx,format);
    xlsx.write("A2","筛选：需做常-STR检材");
    xlsx.write("B2","扩增试剂盒:"+STRtype[0]);
    xlsx.write("C2","体系:"+sysval);
    xlsx.write("D2","循环数:29");
    xlsx.mergeCells("A3:A4");
    xlsx.mergeCells("B3:B4");
    xlsx.mergeCells("C3:C4");
    xlsx.mergeCells("D3:E3");
    xlsx.mergeCells("F3:F4");
    xlsx.mergeCells("G3:M3");
    xlsx.mergeCells("N3:P3");
    xlsx.write("A3","序号");
    xlsx.write("B3","孔位");
    xlsx.write("C3","样本名称");
    xlsx.write("D3","STR扩增加样方案");
    xlsx.write("D4","加水体积\n（μL）");
    xlsx.write("E4","模板体积\n（μL）");
    xlsx.write("F3","备注");
    xlsx.write("G3","定量浓度及其它参数");
    xlsx.write("G4","总浓度\n ng/μL");
    xlsx.write("H4","男性浓度\n ng/μL");
    xlsx.write("I4","女性浓度\n ng/μL");
    xlsx.write("J4","降解指数\n（DI）");
    xlsx.write("K4","抑制指数\n（ICS）");
    xlsx.write("L4","性别情况");
    xlsx.write("M4","男女浓度比例");
    xlsx.write("N3","CT值");
    xlsx.write("N4","Y");
    xlsx.write("O4","AS");
    xlsx.write("P4","AL");
    QList<QString> label;
    label<<"A"<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H"<<"I"<<"J"<<"K"<<"L"<<"M"<<"N"<<"O"<<"P";
    int xh=1;
    int hang=5;
    for(int i=0;i<outtab2c.length();i+=4){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][2]=="常STR"&&(outtab2c[i][0]==sx[j]||false)){
                for(int j=0;j<label.length()+1;j++){
                    if(j==0){
                        xlsx.write(label[j]+QString::number(hang),QString::number(xh));
                    }else if(j>=1&&j<=2){
                        xlsx.write(label[j]+QString::number(hang),outtab2c[i][j-1]);
                    }else if(j==3){
                        if(outtab2c[i][3]!="无"){
                            xlsx.write(label[j]+QString::number(hang),"2");
                        }else{
                            if(sysval=="10"){
                                xlsx.write(label[j]+QString::number(hang),QString::number(map.value("Mv").toInt()-outtab2c[i][10].toInt()));
                            }else{
                                xlsx.write(label[j]+QString::number(hang),QString::number(map.value("Mv*").toInt()-outtab2c[i][10].toInt()));
                            }
                        }
                        xlsx.write(label[j+1]+QString::number(hang),outtab2c[i][10]);
                    }else if(j==5){
                        xlsx.write(label[j]+QString::number(hang),outtab2c[i][11]);
                    }else if(j>=6&&j<=8){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][j]);
                    }else if(j>=9&&j<=10){
                        if(j==9){
                            if(outtab1[i][j+2].toDouble()>1.5){
                                QXlsx::Format format;
                                format.setFontColor(Qt::red);
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2],format);
                            }else{
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2]);
                            }
                        }else if(j==10){
                            if(outtab1[i][j+2].toDouble()>0.3){
                                QXlsx::Format format;
                                format.setFontColor(Qt::red);
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2],format);
                            }else{
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2]);
                            }
                        }

                    }else if(j>=11&&j<=12){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][j-2]);
                    }else if(j==13){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][4]);
                    }else if(j==14){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i+1][4]);
                    }else if(j==15){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i+2][4]);
                    }
                }
                xh++;
                hang++;
            }
        }
    }
    xh=0;
    hang++;
    xlsx.write("A"+QString::number(hang),"说明：");
    xlsx.write("B"+QString::number(hang),"1、DI值为红色字体的表明样品有降解，数值越大，降解程度越大，DI值大于10或无值为严重降解。");
    hang++;
    xlsx.write("B"+QString::number(hang),"2、ICS为红色字体的表明样品可能含有抑制剂，是否影响下游STR取决于STR试剂盒的抗抑制能力，数值越大，可能的抑制程度越高。无值会严重抑制STR扩增。");
    hang++;
    xlsx.write("B"+QString::number(hang),"3、若浓度较高需要稀释的样品较多，这部分样品也可以不稀释，适当降低循环数加1ul扩增。");
    hang+=2;
    xlsx.write("A"+QString::number(hang),"筛选：需稀释检材");
    hang++;
    xlsx.write("A"+QString::number(hang),"样品位置(所有样品)");
    xlsx.write("B"+QString::number(hang),"检材编号");
    xlsx.write("C"+QString::number(hang),"检测方案(链接常-STR模型“检测方案”)");
    xlsx.write("D"+QString::number(hang),"总稀释倍数DFa(链接常-STR模型相应“总稀释倍数”)");
    xlsx.mergeCells("E"+QString::number(hang)+":"+"G"+QString::number(hang));
    xlsx.write("E"+QString::number(hang),"第一步稀释方案");
    xlsx.mergeCells("H"+QString::number(hang)+":"+"J"+QString::number(hang));
    xlsx.write("H"+QString::number(hang),"第二步稀释方案");
    xlsx.write("K"+QString::number(hang),"备注");
    hang++;
    xlsx.write("E"+QString::number(hang),"稀释倍数1");
    xlsx.write("F"+QString::number(hang),"样品体积(ul)");
    xlsx.write("G"+QString::number(hang),"稀释液体积(ul)");
    xlsx.write("H"+QString::number(hang),"稀释倍数2");
    xlsx.write("I"+QString::number(hang),"上一步稀释产物(ul)");
    xlsx.write("J"+QString::number(hang),"稀释液体积(ul)");
    for(int i=0;i<outtab2c.length();i+=4){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][3]!="无"&&(outtab2c[i][2]=="常STR"||outtab2c[i][2]=="mini-STR")&&(outtab2c[i][0]==sx[j]||false)){
                for(int k=0;k<label.length()-5;k++){
                    if(k>=0&&k<=9){
                        xlsx.write(label[k]+QString::number(hang),outtab2c[i][k]);
                    }
                    if(k==10){
                        xlsx.write(label[k]+QString::number(hang),outtab2c[i][11]);
                    }
                }
                hang++;
            }
        }
    }
    //    for(int i=0;i<outtab2.length();i+=4){
    //        if(outtab2c[i][2]=="Y-STR"){
    //            for(int j=0;j<label.length()-5;j++){
    //                if(j>=0&&j<=9){
    //                    xlsx.write(label[j]+QString::number(hang),outtab2[i][j]);
    //                }
    //                if(j==10){
    //                    xlsx.write(label[j]+QString::number(hang),outtab2[i][11]);
    //                }
    //            }
    //            hang++;
    //        }
    //    }
    hang++;
    xh=0;
    xlsx.write("A"+QString::number(hang),"筛选：需做Y-STR检材");
    xlsx.write("B"+QString::number(hang),"扩增试剂盒:"+STRtype[1]);
    xlsx.write("C"+QString::number(hang),"体系:"+sysval);
    xlsx.write("D"+QString::number(hang),"循环数:29");
    hang++;
    xlsx.mergeCells("A"+QString::number(hang)+":A"+QString::number(hang+1));
    xlsx.mergeCells("B"+QString::number(hang)+":B"+QString::number(hang+1));
    xlsx.mergeCells("C"+QString::number(hang)+":C"+QString::number(hang+1));
    xlsx.mergeCells("D"+QString::number(hang)+":E"+QString::number(hang));
    xlsx.mergeCells("F"+QString::number(hang)+":F"+QString::number(hang+1));
    xlsx.mergeCells("G"+QString::number(hang)+":M"+QString::number(hang));
    xlsx.mergeCells("N"+QString::number(hang)+":P"+QString::number(hang));
    xlsx.write("A"+QString::number(hang),"序号");
    xlsx.write("B"+QString::number(hang),"孔位");
    xlsx.write("C"+QString::number(hang),"样本名称");
    xlsx.write("D"+QString::number(hang),"STR扩增加样方案");
    xlsx.write("D"+QString::number(hang+1),"加水体积\n（μL）");
    xlsx.write("E"+QString::number(hang+1),"模板体积\n（μL）");
    xlsx.write("F"+QString::number(hang),"备注");
    xlsx.write("G"+QString::number(hang),"定量浓度及其它参数");
    xlsx.write("G"+QString::number(hang+1),"总浓度\n ng/μL");
    xlsx.write("H"+QString::number(hang+1),"男性浓度\n ng/μL");
    xlsx.write("I"+QString::number(hang+1),"女性浓度\n ng/μL");
    xlsx.write("J"+QString::number(hang+1),"降解指数\n（DI）");
    xlsx.write("K"+QString::number(hang+1),"抑制指数\n（ICS）");
    xlsx.write("L"+QString::number(hang+1),"性别情况");
    xlsx.write("M"+QString::number(hang+1),"男女浓度比例");
    xlsx.write("N"+QString::number(hang),"CT值");
    xlsx.write("N"+QString::number(hang+1),"Y");
    xlsx.write("O"+QString::number(hang+1),"AS");
    xlsx.write("P"+QString::number(hang+1),"AL");
    hang+=3;
    for(int i=0;i<outtab2.length();i+=4){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][2]=="Y-STR"&&(outtab2c[i][0]==sx[j]||false)){
                for(int j=0;j<label.length()+1;j++){
                    if(j==0){
                        xlsx.write(label[j]+QString::number(hang),QString::number(xh));
                    }else if(j>=1&&j<=2){
                        xlsx.write(label[j]+QString::number(hang),outtab2[i][j-1]);
                    }else if(j==3){
                        if(outtab2[i][3]!="无"){
                            xlsx.write(label[j]+QString::number(hang),"2");
                        }else{
                            if(sysval=="10"){
                                xlsx.write(label[j]+QString::number(hang),QString::number(map.value("Mv").toInt()-outtab2[i][10].toInt()));
                            }else{
                                xlsx.write(label[j]+QString::number(hang),QString::number(map.value("Mv*").toInt()-outtab2[i][10].toInt()));
                            }
                        }
                        xlsx.write(label[j+1]+QString::number(hang),outtab2[i][10]);
                    }else if(j==5){
                        xlsx.write(label[j]+QString::number(hang),outtab2[i][11]);
                    }else if(j>=6&&j<=8){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][j]);
                    }else if(j>=9&&j<=10){
                        if(j==9){
                            if(outtab1[i][j+2].toDouble()>1.5){
                                QXlsx::Format format;
                                format.setFontColor(Qt::red);
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2],format);
                            }else{
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2]);
                            }
                        }else if(j==10){
                            if(outtab1[i][j+2].toDouble()>0.3){
                                QXlsx::Format format;
                                format.setFontColor(Qt::red);
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2],format);
                            }else{
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2]);
                            }
                        }

                    }else if(j>=11&&j<=12){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][j-2]);
                    }else if(j==13){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][4]);
                    }else if(j==14){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i+1][4]);
                    }else if(j==15){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i+2][4]);
                    }
                }
                xh++;
                hang++;
            }
        }
    }
    xh=0;
    hang++;
    xlsx.write("A"+QString::number(hang),"筛选：需做mini-STR检材");
    xlsx.write("B"+QString::number(hang),"扩增试剂盒:"+STRtype[2]);
    xlsx.write("C"+QString::number(hang),"体系:"+sysval);
    xlsx.write("D"+QString::number(hang),"循环数:29");
    hang++;
    xlsx.mergeCells("A"+QString::number(hang)+":A"+QString::number(hang+1));
    xlsx.mergeCells("B"+QString::number(hang)+":B"+QString::number(hang+1));
    xlsx.mergeCells("C"+QString::number(hang)+":C"+QString::number(hang+1));
    xlsx.mergeCells("D"+QString::number(hang)+":E"+QString::number(hang));
    xlsx.mergeCells("F"+QString::number(hang)+":F"+QString::number(hang+1));
    xlsx.mergeCells("G"+QString::number(hang)+":M"+QString::number(hang));
    xlsx.mergeCells("N"+QString::number(hang)+":P"+QString::number(hang));
    xlsx.write("A"+QString::number(hang),"序号");
    xlsx.write("B"+QString::number(hang),"孔位");
    xlsx.write("C"+QString::number(hang),"样本名称");
    xlsx.write("D"+QString::number(hang),"STR扩增加样方案");
    xlsx.write("D"+QString::number(hang+1),"加水体积\n（μL）");
    xlsx.write("E"+QString::number(hang+1),"模板体积\n（μL）");
    xlsx.write("F"+QString::number(hang),"备注");
    xlsx.write("G"+QString::number(hang),"定量浓度及其它参数");
    xlsx.write("G"+QString::number(hang+1),"总浓度\n ng/μL");
    xlsx.write("H"+QString::number(hang+1),"男性浓度\n ng/μL");
    xlsx.write("I"+QString::number(hang+1),"女性浓度\n ng/μL");
    xlsx.write("J"+QString::number(hang+1),"降解指数\n（DI）");
    xlsx.write("K"+QString::number(hang+1),"抑制指数\n（ICS）");
    xlsx.write("L"+QString::number(hang+1),"性别情况");
    xlsx.write("M"+QString::number(hang+1),"男女浓度比例");
    xlsx.write("N"+QString::number(hang),"CT值");
    xlsx.write("N"+QString::number(hang+1),"Y");
    xlsx.write("O"+QString::number(hang+1),"AS");
    xlsx.write("P"+QString::number(hang+1),"AL");
    hang+=3;
    for(int i=0;i<outtab2c.length();i+=4){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][2]=="mini-STR"&&(outtab2c[i][0]==sx[j]||false)){
                for(int j=0;j<label.length()+1;j++){
                    if(j==0){
                        xlsx.write(label[j]+QString::number(hang),QString::number(xh));
                    }else if(j>=1&&j<=2){
                        xlsx.write(label[j]+QString::number(hang),outtab2c[i][j-1]);
                    }else if(j==3){
                        if(outtab2c[i][3]!="无"){
                            xlsx.write(label[j]+QString::number(hang),"2");
                        }else{
                            if(sysval=="10"){
                                xlsx.write(label[j]+QString::number(hang),QString::number(map.value("Mv").toInt()-outtab2c[i][10].toInt()));
                            }else{
                                xlsx.write(label[j]+QString::number(hang),QString::number(map.value("Mv*").toInt()-outtab2c[i][10].toInt()));
                            }
                        }
                        xlsx.write(label[j+1]+QString::number(hang),outtab2c[i][10]);
                    }else if(j==5){
                        xlsx.write(label[j]+QString::number(hang),outtab2c[i][11]);
                    }else if(j>=6&&j<=8){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][j]);
                    }else if(j>=9&&j<=10){
                        if(j==9){
                            if(outtab1[i][j+2].toDouble()>1.5){
                                QXlsx::Format format;
                                format.setFontColor(Qt::red);
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2],format);
                            }else{
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2]);
                            }
                        }else if(j==10){
                            if(outtab1[i][j+2].toDouble()>0.3){
                                QXlsx::Format format;
                                format.setFontColor(Qt::red);
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2],format);
                            }else{
                                xlsx.write(label[j]+QString::number(hang),outtab1[i][j+2]);
                            }
                        }

                    }else if(j>=11&&j<=12){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][j-2]);
                    }else if(j==13){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i][4]);
                    }else if(j==14){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i+1][4]);
                    }else if(j==15){
                        xlsx.write(label[j]+QString::number(hang),outtab1[i+2][4]);
                    }
                }
                xh++;
                hang++;
            }
        }
    }
    xlsx.addSheet("加样表格");

    QList<QString> rowList;
    rowList<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H"<<"I"<<"J"<<"K"<<"L"<<"M";
    QList<QString> namelist;
    namelist<<"A"<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H"<<"I"<<"J"<<"K"<<"L";

    QList<QString> columList;
    columList<<"A"<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H";


    xlsx.write("A1","常-STR加样表格");
    for (int i=0;i<rowList.length();i++) {
        xlsx.write(rowList[i]+"2",QString::number(i+1));
    }
    for (int i=0;i<columList.length();i++)
    {
        xlsx.write("A"+QString::number(i+3),columList[i]);
    }

    xlsx.write("A12","Y-STR加样表格");
    for (int i=0;i<rowList.length();i++) {
        xlsx.write(rowList[i]+"13",QString::number(i+1));
    }
    for (int i=0;i<columList.length();i++)
    {
        xlsx.write("A"+QString::number(i+14),columList[i]);
    }

    xlsx.write("A23","mini-STR加样表格");
    for (int i=0;i<rowList.length();i++) {
        xlsx.write(rowList[i]+"24",QString::number(i+1));
    }
    for (int i=0;i<columList.length();i++)
    {
        xlsx.write("A"+QString::number(i+25),columList[i]);
    }

    for (int i=0;i<outtab2c.length();i++){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][2]=="常STR"&&(outtab2c[i][0]==sx[j]||false)){
                QString pos=outtab2c[i][0];

                QString info=outtab2c[i][10];

                QString rowInfo;
                QString colInfo;

                if(pos.length()==3){
                    rowInfo= pos.left(1);
                    colInfo=pos.right(2);
                }else{
                    rowInfo= pos.left(1);
                    colInfo=pos.right(1);
                }

                QString finalPos = rowList[colInfo.toInt()-1]+ QString::number(columList.indexOf(rowInfo)+3);
                xlsx.write(finalPos,info);
            }
        }
    }
    for (int i=0;i<outtab2.length();i++){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][2]=="Y-STR"&&(outtab2c[i][0]==sx[j]||false)){
                QString pos=outtab2[i][0];

                QString info=outtab2[i][10];

                QString rowInfo;
                QString colInfo;

                if(pos.length()==3){
                    rowInfo= pos.left(1);
                    colInfo=pos.right(2);
                }else{
                    rowInfo= pos.left(1);
                    colInfo=pos.right(1);
                }

                QString finalPos = rowList[colInfo.toInt()-1]+ QString::number(columList.indexOf(rowInfo)+14);
                xlsx.write(finalPos,info);
            }
        }
    }
    for (int i=0;i<outtab2c.length();i++){
        for(int j=0;j<sx.length();j++){
            if(outtab2c[i][2]=="mini-STR"&&(outtab2c[i][0]==sx[j]||false)){
                QString pos=outtab2c[i][0];

                QString info=outtab2c[i][10];

                QString rowInfo;
                QString colInfo;

                if(pos.length()==3){
                    rowInfo= pos.left(1);
                    colInfo=pos.right(2);
                }else{
                    rowInfo= pos.left(1);
                    colInfo=pos.right(1);
                }

                QString finalPos = rowList[colInfo.toInt()-1]+ QString::number(columList.indexOf(rowInfo)+14);
                xlsx.write(finalPos,info);
            }
        }
    }
}
// 筛选
QVector<QVector<QString>> dataanatool::sx(QString type){
    QVector<QVector<QString>> fanlist;
    if(type=="总数"){
        for(int i=0;i<outtab2.length();i+=4){
            fanlist.append(outtab2[i]);
        }
        return fanlist;
    }else if(type=="常STR"){
        for(int i=0;i<outtab2c.length();i+=4){
            if(outtab2c[i][2]=="常STR"){
                fanlist.append(outtab2c[i]);
            }
        }
        return fanlist;
    }else if(type=="Y-STR"){
        for(int i=0;i<outtab2.length();i+=4){
            if(outtab2[i][2]=="Y-STR"){
                fanlist.append(outtab2[i]);
            }
        }
        return fanlist;
    }else if(type=="mini-STR"){
        for(int i=0;i<outtab2c.length();i+=4){
            if(outtab2c[i][2]=="mini-STR"){
                fanlist.append(outtab2c[i]);
            }
        }
        return fanlist;
    }else if(type=="稀释"){
        for(int i=0;i<outtab2c.length();i+=4){
            if(outtab2c[i][3]!="无"){
                fanlist.append(outtab2c[i]);
            }
        }
        for(int i=0;i<outtab2c.length();i+=4){
            if(outtab2c[i][3]!="无"){
                if(outtab2[i][2]=="Y-STR"){
                    fanlist.append(outtab2c[i]);
                }
            }
        }
        return fanlist;
    }
    return fanlist;
}
// 数量
QList<int> dataanatool::sl(){
    int chang=0,y=0,mini=0,xx=0,zong=0;// 常 Y mini 稀释 总
    for(int i=0;i<outtab2c.length();i+=4){
        if(outtab2c[i][2]=="常STR"){
            chang++;
        }
        if(outtab2c[i][2]=="mini-STR"){
            mini++;
        }
    }
    for(int i=0;i<outtab2.length();i+=4){
        if(outtab2[i][2]=="Y-STR"){
            y++;
        }
    }
    zong=outtab2.length()/4;
    for(int i=0;i<outtab2c.length();i+=4){
        if(outtab2c[i][3]!="无"){
            xx++;
        }
    }
    for(int i=0;i<outtab2.length();i+=4){
        if(outtab2[i][3]!="无"&&outtab2[i][2]=="Y-STR"){
            xx++;
        }
    }
    QList<int> alldata;
    alldata<<chang<<y<<mini<<xx<<zong;
    return alldata;

}
